package com.hqyj.springboot.modules.account.dao;

import com.hqyj.springboot.modules.account.entity.UserRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface UserRoleDao2 {
    @Insert("insert into test_user_role (create_date,update_date,user_id,role_id) values (#{createDate},${updaateDate},#{userId},#{roleId})")
    @Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
    void addUserRole(UserRole userRole);

    @Delete("delete from test_user_role where role_id = #{id}")
    void deleteUserRoleByRoleId(int id);

    @Delete("delete from test_user_role where user_id = #{id}")
    void deleteUserRoleByUserId(int id);

}
